#include "GameView.h"
#include "Map.h"


void GameView::createView()
{
	this->addChild(Map::create());
	m_myPlane=PlayerPlane::create();
	this->addChild(m_myPlane);
	m_myPlane->setPosition(ccp(200,100));
	setTouchEnabled(true);
	//scheduleUpdate();
}



void GameView::ccTouchesBegan( CCSet *pTouches, CCEvent *pEvent )
{
	CCSetIterator it = pTouches->begin();
	CCTouch* touch = (CCTouch*)(*it);
	CCPoint cpBeginPos = touch->locationInView();
	//CCLOG("(%f,%f)",cpBeginPos.x,cpBeginPos.y);
	cpBeginPos=CCDirector::sharedDirector()->convertToGL( cpBeginPos );
	//CCLOG("(%f,%f)",cpBeginPos.x,cpBeginPos.y);

	
}

void GameView::ccTouchesMoved( CCSet *pTouches, CCEvent *pEvent )
{
	CCSetIterator it = pTouches->begin();
	CCTouch* touch = (CCTouch*)(*it);
	CCPoint cpBeginPos = touch->locationInView();
	cpBeginPos=CCDirector::sharedDirector()->convertToGL( cpBeginPos );
	m_myPlane->setPosition(cpBeginPos);
	//CCLOG("(%f,%f)",cpBeginPos.x,cpBeginPos.y);

}

void GameView::ccTouchesEnded( CCSet *pTouches, CCEvent *pEvent )
{

}
